package shop.util;


import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.SQLException;


public class ConnectionManager {

	static Connection con;
	static private String database = "bookshop";
	static private String username = "root";
	static private String password = "";

	public static Connection getConnection()
	{

		try
		{
			// assuming "DataSource" is your DataSource name
			String url = "jdbc:odbc:" + database; 

			Class.forName("com.mysql.jdbc.Driver");

			try
			{            	
				// assuming your SQL Server's	username is "username"               
				// and password is "password
				con = DriverManager.getConnection("jdbc:mysql://localhost/bookshop?user="+username+"&amp;password="+password); 
			}

			catch (SQLException ex)
			{
				ex.printStackTrace();
			}
		}

		catch(ClassNotFoundException e)
		{
			System.out.println(e);
		}

		return con;
	}
}